﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml.Linq;

namespace PicasaManager
{
    public class GoogleMediaContent
    {
        public string Url { get; set; }
        public string Type { get; set; }
        public string Medium { get; set; }
        public int Height { get; set; }
        public int Width { get; set; }
        public int Size { get; set; }

        public static GoogleMediaContent FromXElement(XElement element)
        {
            GoogleMediaContent media = new GoogleMediaContent();
            foreach (var attribute in element.Attributes())
            {
                switch (attribute.Name.LocalName)
                {
                    case "url": media.Url = attribute.Value; break;
                    case "width": media.Width = Convert.ToInt32(attribute.Value); break;
                    case "height": media.Height = Convert.ToInt32(attribute.Value); break;
                    case "medium": media.Medium = attribute.Value; break;
                    case "type": media.Type = attribute.Value; break;
                    case "size": media.Size = Convert.ToInt32(attribute.Value); break;
                }
            }
            return media;
        }
    }


}
